package org.sheriff.cfi.controller;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.sheriff.cfi.vo.*;
import org.sheriff.cfi.model.bl.*;

/**
 * Servlet implementation class AnalysisRequestServlet
 */
@WebServlet("/AnalysisRequestServlet")
public class AnalysisRequestServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

    /**
     * Default constructor. 
     */
    public AnalysisRequestServlet() {
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
		
		try{
			String RequestType=request.getParameter("RequestType");
			
			System.out.println("Radio button value is  "+RequestType);
			
			String RequestDate=request.getParameter("RequestDate");
			System.out.println("Request date is  "+RequestDate);
			
			String CaseTitle=request.getParameter("CaseTitle");
			System.out.println("Case Title is  "+CaseTitle);
			
			String CaseDetectiveOfficer =request.getParameter("CaseDetectiveOfficer");
			System.out.println("Case Detective Officer is  "+CaseDetectiveOfficer);
			
			String CaseNumber =request.getParameter("CaseNumber");
			System.out.println("Case Number is  "+CaseNumber);
			
			String Agency  =request.getParameter("Agency");
			System.out.println("Agency is  "+Agency);
			
			String OtherAgencyCaseNumber  =request.getParameter("OtherAgencyCaseNumber");
			System.out.println("Other Agency Case Number is  "+OtherAgencyCaseNumber);
			
			String Address  =request.getParameter("Address");
			System.out.println("Address is  "+Address);
			
			String Office_or_Desk_Phone  =request.getParameter("Office_or_Desk_Phone");
			System.out.println("Office_or_Desk_Phone is  "+Office_or_Desk_Phone);
			
			String City  =request.getParameter("City");
			System.out.println("City is  "+City);
			
			String Cell_or_Pager  =request.getParameter("Cell_or_Pager");
			System.out.println("Cell_or_Pager is  "+Cell_or_Pager);
			
			String State =request.getParameter("State");
			System.out.println("State is  "+State);
			
			String Zipcode =request.getParameter("Zipcode");
			System.out.println("Zipcode is  "+Zipcode);
			
			String Email =request.getParameter("Email");
			System.out.println("Email is  "+Email);
			
			String Devices[] = request.getParameterValues("Devices");
			if (Devices != null) {
				System.out.println("Devices are :");
				for(String device: Devices) {
					System.out.println("\t" + device);
				}
				
				
			}
			
			String casetype =request.getParameter("casetype");
			System.out.println("casetype is  "+casetype);
			
			String BriefDescription=request.getParameter("BriefDescription");
			System.out.println("Brief Description of Case is  "+BriefDescription);
			
			
			String AnalysisRequested  =request.getParameter("AnalysisRequested");
			System.out.println("AnalysisRequested is  "+AnalysisRequested);
			
			
			
			
			
			//Load data in AnalysisRequestVO object
			
			AnalysisRequestVO arvo= new AnalysisRequestVO();
			
			arvo.setCaseNumber(CaseNumber);
			arvo.setCaseType(casetype);
			
			// create an object for AnalysisRequestBL
			
			AnalysisRequestBL  arbl= new AnalysisRequestBL();
			arbl.requestAnalysisInfo(arvo);
			
			
			
			
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}

}
